import ImageLayer from "ol/layer/Image"
import { ImageWMS } from "ol/source"

// 1-创建图层，接入WMS服务
export const createWMSLayer = (workSpace, workName) => {
  const layer = new ImageLayer({
    source: new ImageWMS({
      url: `/geoserver/${workSpace}/wms`,
      params: { 'LAYERS': `${workSpace}:${workName}` },
      ratio: 1,
      serverType: 'geoserver',
    }),
  })
  return layer
}